<script type="text/javascript" src="${ctx}/public/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="${ctx}/public/plugins/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="${ctx}/public/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="${ctx}/public/plugins/ueditor/ueditor-ext.js"></script>
<style>
       .formTable ul{list-style:none;width: auto;margin: 0;padding: 0;}
       .formTable li{list-style-type: none;float:left;margin: 5px;padding: 0;}
 </style>
<form id="roleForm" method="post">
	<table class="formTable">
		<tr>
			<td class="table_left"><font color="red">*</font>角色名称：</td>
			<td>
				<input type="hidden" name="id"/>
				<input name="role_name" data-options="required:true,width: 200" type="text" class="easyui-textbox"/> 
			</td>
			<td class="table_left"><font color="red">*</font>角色编码：</td>
			<td><input name="role_code" type="text" class="easyui-textbox" data-options="width: 200,required:true"/></td>
		</tr>
		<tr>
			<td class="table_left">状态</td>
            <td><select id="status" name="status"></select></td>
			<td class="table_left">描述：</td>
			<td>
				<input class="easyui-textbox" name="remark" data-options="multiline:true" value="" style="width:250px;height:80px">
			</td>
		</tr>
		<tr>
			<td class="table_left">描述：</td>
			<td colspan="3">
				<button type="button" id="j_upload_file_btn">附件上传</button>
				<ul id="upload_file_wrap"></ul>
                <script id="container" style="width:640px;height:540px;display: none;" name="content" type="text/plain"></script>		
             </td>
		</tr>
	</table>
</form>
<script type="text/javascript">
   var uploadEditor = UE.getEditor("container", {
       isShow: false,
       focus: false,
       enableAutoSave: false,
       autoSyncData: false,
       autoFloatEnabled:false,
       wordCount: false,
       sourceEditor: null,
       scaleEnabled:true,
       toolbars: [["insertimage", "attachment"]]
   });
   // 监听多图上传和上传附件组件的插入动作
   uploadEditor.ready(function () {
          uploadEditor.addListener("afterUpfile",_afterUpfile);
   });

   document.getElementById('j_upload_file_btn').onclick = function () {
       var dialog = uploadEditor.getDialog("attachment");
       dialog.title = '附件上传';
       dialog.render();
       dialog.open();
   };

    // 附件上传
   function _afterUpfile(t, result) {
          var fileHtml = '';
          for(var i in result){
              var filename=result[i].url.substring(result[i].url.lastIndexOf("$")+1,result[i].url.length);
              fileHtml += '<li><a href="'+result[i].url+'" target="_blank">'+filename+'</a></li>';
          }
          document.getElementById('upload_file_wrap').innerHTML = fileHtml;
    }
</script>